﻿--Create Categories table
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Categories](
	[CategoryId] [int] NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[PosId] [tinyint] NOT NULL,
 CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED 
(
	[CategoryId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

--Create Exceptions table

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Exceptions](
	[WordId] [decimal](18, 0) NOT NULL,
	[Exception] [nvarchar](150) NOT NULL,
	[PosId] [tinyint] NOT NULL
) ON [PRIMARY]
GO

--Create PartsOfSpeech table

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PartsOfSpeech](
	[PosId] [tinyint] NOT NULL,
	[Abreviation] [char](1) NOT NULL,
	[Name] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_PartsOfSpeech] PRIMARY KEY CLUSTERED 
(
	[PosId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

--Create Relations table

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Relations](
	[SourceWordId] [decimal](18, 0) NULL,
	[SourceSynsetId] [decimal](18, 0) NOT NULL,
	[TargetWordId] [decimal](18, 0) NULL,
	[TargetSynsetId] [decimal](18, 0) NOT NULL,
	[RelationId] [decimal](18, 0) IDENTITY(1,1) NOT NULL,
	[TypeId] [int] NOT NULL,
 CONSTRAINT [PK_Relations] PRIMARY KEY CLUSTERED 
(
	[RelationId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

--Create RelationTypes table

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RelationTypes](
	[RelationTypeId] [int] NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[Symbol] [nvarchar](5) NULL,
	[Reflect] [int] NULL,
 CONSTRAINT [PK_RelationTypes] PRIMARY KEY CLUSTERED 
(
	[RelationTypeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

--Create Senses table

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Senses](
	[WordId] [decimal](18, 0) NOT NULL,
	[SynsetId] [decimal](18, 0) NOT NULL,
	[SenseId] [decimal](18, 0) IDENTITY(1,1) NOT NULL,
	[SenseNumber] [int] NULL,
	[TagCount] [int] NULL,
	[Marker] [nvarchar](5) NULL,
	[Index] [int] NOT NULL,
 CONSTRAINT [PK_Senses] PRIMARY KEY CLUSTERED 
(
	[SenseId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

--Create SenseSentenceAssociations

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SenseSentenceAssociations](
	[SenseId] [decimal](18, 0) NULL,
	[SentenceId] [decimal](18, 0) NOT NULL
) ON [PRIMARY]

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- Create Sentences table

CREATE TABLE [dbo].[Sentences](
	[SentenceId] [decimal](18, 0) IDENTITY(1,1) NOT NULL,
	[Text] [nvarchar](500) NOT NULL,
	[IsFrame] [bit] NOT NULL,
	[WordNetId] [decimal](18, 0) NOT NULL,
 CONSTRAINT [PK_Sentences] PRIMARY KEY CLUSTERED 
(
	[SentenceId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

--Create Synsets table

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Synsets](
	[SynsetId] [decimal](18, 0) NOT NULL,
	[CategoryId] [int] NOT NULL,
	[PosId] [tinyint] NOT NULL,
	[Glossary] [ntext] NULL,
 CONSTRAINT [PK_Synsets] PRIMARY KEY CLUSTERED 
(
	[SynsetId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

--Create Words table

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Words](
	[Lemma] [nvarchar](300) NOT NULL,
	[WordId] [decimal](18, 0) IDENTITY(1,1) NOT NULL,
	[WordCount] [tinyint] NOT NULL,
 CONSTRAINT [PK_Words] PRIMARY KEY CLUSTERED 
(
	[WordId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]